#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    long int tosses;
    long int hits;
    hits=0;
    float x,y;
    cout<<"Enter the no. of tosses"<<endl;
    cin>>tosses;
    unsigned seed=time(NULL);
    srand(seed);
    for(long int i=0;i<tosses;i++)
    {
        x=float(rand())/RAND_MAX;
        y=float(rand())/RAND_MAX;
        if((x*x+y*y)<1)
        ++hits;
    }
    cout<<"The value of pi for"<<tosses<<"tosses:"<<4.0*hits/tosses;
    cin.get();
}
